package softswitch.model;

import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name = "circuit", schema = "softswitch")
public class Circuit{
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE)
	private Integer id;
	private String name;

	@Column(unique = true)
	private Long code;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date creationdate;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date activationdate;
	
	private Double credit;
	private Boolean notifylowbalance;
	private Integer notifylowbalancevalue;
	private Boolean billable;
	private Boolean enabled;
	
	
	@ManyToOne
	private Plan plan;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="circuit")
	private List<Package> packags;
		
	@OneToMany(cascade=CascadeType.ALL, mappedBy="circuit")
	private List<Restriction> restrictions;

	@OneToMany(cascade=CascadeType.ALL, mappedBy="circuit")
	private List<Refill> refills;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="circuit")
	private List<CallDetail> calldetail;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="circuit")
	private List<CallLog> calllog;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="circuit")
	private List<PackageSummary> packagesummary;
		
	@OneToMany(cascade=CascadeType.ALL, mappedBy="circuit")
	private List<CallSummaryRouteGroup> callsummary;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="circuit")
	private List<Did> dids;
	
	//---------------------------------------------------------------

	private Integer organization_id;
	
	
	//---------------------------------------------------------------
	
	public Circuit() {
		super();
	}
	
	public Circuit(String name, Long code, Double credit, Plan plan, Integer organization_id,Boolean billable, Boolean enabled) {
		super();
		this.name = name;
		this.code = code;
		this.credit = credit;
		this.plan = plan;
		this.organization_id = organization_id;
		this.billable = billable;
	}
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Long getCode() {
		return code;
	}
	public void setCode(Long code) {
		this.code = code;
	}
	public Date getCreationdate() {
		return creationdate;
	}
	public void setCreationdate(Date creationdate) {
		this.creationdate = creationdate;
	}
	public Double getCredit() {
		return credit;
	}
	public void setCredit(Double credit) {
		this.credit = credit;
	}
	public Boolean isNotifylowbalance() {
		return notifylowbalance;
	}
	public void setNotifylowbalance(Boolean notifylowbalance) {
		this.notifylowbalance = notifylowbalance;
	}
	public Integer getNotifylowbalancevalue() {
		return notifylowbalancevalue;
	}
	public void setNotifylowbalancevalue(Integer notifylowbalancevalue) {
		this.notifylowbalancevalue = notifylowbalancevalue;
	}
	public Plan getPlan() {
		return plan;
	}
	public void setPlan(Plan plan) {
		this.plan = plan;
	}		
	public Integer getOrganization_id() {
		return organization_id;
	}
	public void setOrganization_id(Integer organization_id) {
		this.organization_id = organization_id;
	}
	public Boolean getNotifylowbalance() {
		return notifylowbalance;
	}	
	public Boolean getBillable() {
		return billable;
	}
	public void setBillable(Boolean billable) {
		this.billable = billable;
	}
	public Boolean getEnabled() {
		return enabled;
	}
	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}

	public Date getActivationdate() {
		return activationdate;
	}

	public void setActivationdate(Date activationdate) {
		this.activationdate = activationdate;
	}

	public List<Package> getPackags() {
		return packags;
	}

	public void setPackags(List<Package> packags) {
		this.packags = packags;
	}

	public List<Restriction> getRestrictions() {
		return restrictions;
	}

	public void setRestrictions(List<Restriction> restrictions) {
		this.restrictions = restrictions;
	}

	public List<Refill> getRefills() {
		return refills;
	}

	public void setRefills(List<Refill> refills) {
		this.refills = refills;
	}

	public List<CallDetail> getCalldetail() {
		return calldetail;
	}

	public void setCalldetail(List<CallDetail> calldetail) {
		this.calldetail = calldetail;
	}

		
}
